package vikaa.tools;

import vikaa.wowo.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.CountDownTimer;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class DialogService {
	public static ProgressDialog pd;
	public static void WarnDialog(Context context,CharSequence title,CharSequence message,
			CharSequence text){
		new AlertDialog.Builder(context).setTitle(title).setMessage(message)
		.setPositiveButton(text, new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
			}
		}).show();
	}
	public static void showProgressDialog(Context context,CharSequence message){
		pd = new ProgressDialog(context);
		pd.setProgressStyle(R.style.loading_small);
		pd.setMessage(message);
		pd.setCancelable(false);
		new CountDownTimer(15000,1000) {
			@Override
			public void onTick(long millisUntilFinished) {
				
			}
			@Override
			public void onFinish() {
				pd.setCancelable(true);
			}
		}.start();
		pd.show();
	}
	public static void closeProgressDialog(){
		pd.dismiss();
	}
	public void CustomeDialog(Context context,View view){
		new AlertDialog.Builder(context).setView(view).show();
	}
	
	
	public static void hideSoftKeypad(Context context){
		((InputMethodManager)context.getSystemService(context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 
				InputMethodManager.HIDE_NOT_ALWAYS);
	}
}
